    <!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>塞纳皇宫-网站后台管理系统</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="icon" href="/static/admin/img/logo.png" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico"> <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/static/admin/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <link href="/static/admin/css/animate.css" rel="stylesheet">
    <link href="/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>活动/新品回收列表 </h5>
                    </div>
                    <div class="ibox-content">
                        <div>
                            <a onclick="Alldellist();" href="javascript:void(0);" class="btn btn-danger ">批量删除</a>
                        </div>
                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th width="50px;"><input type="checkbox"  class="i-checks"  id="selectAll"></th>
                                    <th>ID</th>
                                    <th>标题</th>
                                    <th>主图</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            {volist name="data" id="v"}
                                <tr class="gradeX">
                                    <td>
                                        <input type="checkbox"  class="i-checks" id="ck_id" name="id"  value="{$v.id}" >
                                    </td>
                                    <td>{$v.id}</td>
                                    <td>{$v.title}</td>
                                    <td><img width="60" height="40px;" src="{$v.main_img}"></td>
                                    <td class="center"><a href="javascript:;" onclick="edit(this,{$v.id})">恢复</a>&nbsp;&nbsp;&nbsp;
                                        <a href="javascript:;" onclick="del(this,{$v.id})">删除</a></td>
                                </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/static/admin/js/plugins/iCheck/icheck.min.js"></script>
    <!-- Data Tables -->
    <script src="/static/admin/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="/static/admin/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <!-- 自定义js -->
    <script src="/static/admin/js/content.js?v=1.0.0"></script>
    <script src="/static/admin/layer/layer.js"></script>
    <!-- Page-Level Scripts -->
    <script>
        //全选
        $('#selectAll').on('ifChecked', function(event){
            $('input#ck_id').iCheck('check');
        });
        //取消全选
        $('#selectAll').on('ifUnchecked', function(event){
            $('input#ck_id').iCheck('uncheck');
        });
        //批量删除
        function Alldellist(){
            var idstr=' ';
            $("input[name='id']:checkbox").each(function(){
                if(true == $(this).is(':checked')){
                    idstr+=$(this).val()+",";
                }
            });
            if(idstr ==' '){
                layer.msg('请至少选择一条');
                return false;
            }
            layer.confirm('确认要删除吗？',function(data){
                $.ajax({
                    url:"/mobile.php/Recycle/delallhd",
                    type:"post",//get
                    data:{ids:idstr},
                    dataType:"json",
                    success:function(data){
                        if(data.code==1){
                            layer.msg(data.msg);
                            setTimeout('window.location.reload();',1000);
                        }else{
                            layer.msg(data.msg);
                        }
                    },
                    error:function(){
                        layer.msg('系统错误');
                    }
                });

            });
        }


        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });

            $('.dataTables-example').dataTable();



        });
        //恢复
        function edit(obj,id){
            layer.confirm('确认要恢复吗？',function(){
                $.post("/mobile.php/Recycle/activityRecovery",{id:id},function(e){
                    if(1==e.code){
                        layer.msg(e.msg);
                        $(obj).parents("tr").remove();
                    }else{
                        layer.msg(e.msg);
                        return false;
                    }
                },'json')
            });
        }
        //删除
        function del(obj,id){
            layer.confirm('确认要删除吗？',function(){
                $.post("/mobile.php/Recycle/activityDel",{id:id},function(e){
                    if(1==e.code){
                        layer.msg(e.msg);
                        $(obj).parents("tr").remove();
                    }else{
                        layer.msg(e.msg);
                    }
                 },'json')
            });
        }
    </script>

    
    

</body>

</html>
